package com.briup.cms.controller;

import com.briup.cms.service.impl.UserServiceImpl;
import com.briup.cms.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
@Api(tags = "咨詢看點管理系統")
public class UserController {

    @Autowired
    private UserServiceImpl userService;

    @GetMapping("/list")
    @ApiOperation(value = "查詢所有用戶")
    public Result selectAll(){
        return Result.success(userService.findAll());
    }

    @GetMapping("/{id}")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value="用戶id")
    })
    public Result getUserById(@PathVariable String id){
        return Result.success(userService.getById(id));
    }

}
